package com.wkbb;

import com.wkbb.socket.SportServerEndpoint;
import com.wkbb.sports.service.StudentOnlineService;
import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import springfox.documentation.swagger2.annotations.EnableSwagger2;


@EnableTransactionManagement
@MapperScan("com.wkbb.sports.mapper")
@SpringBootApplication
@EnableSwagger2
@EnableDiscoveryClient
@EnableFeignClients
@Slf4j
public class WkbbSportsApplication {

    public static void main(String[] args) {
        ConfigurableApplicationContext applicationContext = SpringApplication.run(WkbbSportsApplication.class, args);
        //config-sport-test.properties socket.offlineHall=true
        if(applicationContext.getEnvironment().getProperty("socket.offlineHall") == null){
            SportServerEndpoint.studentOnlineService.offlineHall();
        }
    }

}
